package com.wilmer.feedbackReply.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.wilmer.common.annotation.Log;
import com.wilmer.common.core.controller.BaseController;
import com.wilmer.common.core.domain.AjaxResult;
import com.wilmer.common.enums.BusinessType;
import com.wilmer.feedbackReply.domain.SysFeedbackReply;
import com.wilmer.feedbackReply.service.ISysFeedbackReplyService;
import com.wilmer.common.utils.poi.ExcelUtil;
import com.wilmer.common.core.page.TableDataInfo;

/**
 * 问题反馈回复Controller
 * 
 * @author Jett
 * @date 2024-05-20
 */
@RestController
@RequestMapping("/feedbackReply/feedbackReply")
public class SysFeedbackReplyController extends BaseController
{
    @Autowired
    private ISysFeedbackReplyService sysFeedbackReplyService;

    /**
     * 查询问题反馈回复列表
     */
    @PreAuthorize("@ss.hasPermi('feedbackReply:feedbackReply:list')")
    @GetMapping("/list")
    public TableDataInfo list(SysFeedbackReply sysFeedbackReply)
    {
        startPage();
        List<SysFeedbackReply> list = sysFeedbackReplyService.selectSysFeedbackReplyList(sysFeedbackReply);
        return getDataTable(list);
    }

    /**
     * 导出问题反馈回复列表
     */
    @PreAuthorize("@ss.hasPermi('feedbackReply:feedbackReply:export')")
    @Log(title = "问题反馈回复", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, SysFeedbackReply sysFeedbackReply)
    {
        List<SysFeedbackReply> list = sysFeedbackReplyService.selectSysFeedbackReplyList(sysFeedbackReply);
        ExcelUtil<SysFeedbackReply> util = new ExcelUtil<SysFeedbackReply>(SysFeedbackReply.class);
        util.exportExcel(response, list, "问题反馈回复数据");
    }

    /**
     * 获取问题反馈回复详细信息
     */
    @PreAuthorize("@ss.hasPermi('feedbackReply:feedbackReply:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(sysFeedbackReplyService.selectSysFeedbackReplyById(id));
    }

    /**
     * 新增问题反馈回复
     */
    @PreAuthorize("@ss.hasPermi('feedbackReply:feedbackReply:add')")
    @Log(title = "问题反馈回复", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody SysFeedbackReply sysFeedbackReply)
    {
        return toAjax(sysFeedbackReplyService.insertSysFeedbackReply(sysFeedbackReply));
    }

    /**
     * 修改问题反馈回复
     */
    @PreAuthorize("@ss.hasPermi('feedbackReply:feedbackReply:edit')")
    @Log(title = "问题反馈回复", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody SysFeedbackReply sysFeedbackReply)
    {
        return toAjax(sysFeedbackReplyService.updateSysFeedbackReply(sysFeedbackReply));
    }

    /**
     * 删除问题反馈回复
     */
    @PreAuthorize("@ss.hasPermi('feedbackReply:feedbackReply:remove')")
    @Log(title = "问题反馈回复", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(sysFeedbackReplyService.deleteSysFeedbackReplyByIds(ids));
    }
}
